<!--
  Copyright 2018-2019 the original author or authors.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<div class="card">
  <div class="card-header">
    <h2>admin.json</h2>
  </div>
  <div class="card-body">
    <div ng-hide="hideMainContent()">
      <div ng-include src="'template/gt-loading-overlay.html'"></div>
      <div ng-include src="'template/gt-http-error-overlay.html'"></div>
      <form gt-form-autofocus-on-first-input
            name="formCtrl"
            style="padding-top: 15px;"
            novalidate>
        <div class="form-group">
          <textarea class="form-control"
                    ng-model="adminJson"
                    ng-trim="false"
                    name="adminJson"
                    id="adminJson"
                    ng-disabled="!layout.adminEdit"
                    ng-style="{'max-width': gtWidth ? gtWidth : 'none'}"
                    rows="{{adminJsonLines()}}"
                    required>
          </textarea>
          <div class="gt-invalid-required-feedback">
            This is required.
          </div>
          <div class="help-block">
            User passwords can be set by adding a "password" attribute (which takes a plain password) or by adding a
            "hashedPassword" attribute (which takes a hashed password).
            <span ng-if="layout.central">
              If needed, user passwords can be hashed manually by running
              <code>java -jar glowroot-central.jar hash-password &lt;plain password&gt;</code>.
            </span>
          </div>
          <div class="help-block">
            SMTP, HTTP Proxy and LDAP passwords can be set by adding a "password" attribute (which takes a plain
            password) or by adding an "encryptedPassword" attribute (which takes an encrypted password).
            <span ng-if="layout.central">
              If needed, SMTP, HTTP Proxy and LDAP passwords can be encrypted manually by running
              <code>java -jar glowroot-central.jar encrypt-password &lt;plain password&gt;</code>.
            </span>
          </div>
        </div>
        <div class="form-group"
             ng-if="layout.adminEdit">
          <div gt-button
               gt-label="Save changes"
               gt-click="save(deferred)"
               gt-validate-form="formCtrl">
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<!-- each page with confirmation dialog needs its own confirmation dom so that it is deleted on $destroy -->
<div ng-include="'template/gt-confirmation.html'"></div>
